--[[   --]]
ardb.call("del", "sorthash", "sortset", "sortzset", "sortlist", "weight_100", "weight_10", "weight_9", "weight_1000")
ardb.call("mset2", "weight_100", "1000", "weight_10", "900", "weight_9", "800", "weight_1000", "700")
ardb.call("hmset","sorthash","field_100","hash100","field_10","hash10","field_9","hash9","field_1000","hash1000")
ardb.call("sadd", "sortset", "100", "10", "9", "1000")
ardb.call("rpush", "sortlist","100","10", "9", "1000")
local vs = ardb.call("sort", "sortset", "limit", "1", "2")
ardb.assert2(table.getn(vs) == 2, vs)
ardb.assert2(vs[1] == "10", vs)
ardb.assert2(vs[2] == "100",vs)
vs = ardb.call("sort", "sortlist", "limit", "1", "2")
ardb.assert2(table.getn(vs) == 2, vs)
ardb.assert2(vs[1] == "10", vs)
ardb.assert2(vs[2] == "100",vs)
vs = ardb.call("sort", "sortset", "by", "weight_*")
ardb.assert2(table.getn(vs) == 4, vs)
ardb.assert2(vs[1] == "1000", vs)
ardb.assert2(vs[2] == "9",vs)
ardb.assert2(vs[3] == "10", vs)
ardb.assert2(vs[4] == "100",vs)
vs = ardb.call("sort", "sortlist", "by", "weight_*")
ardb.assert2(table.getn(vs) == 4, vs)
ardb.assert2(vs[1] == "1000", vs)
ardb.assert2(vs[2] == "9",vs)
ardb.assert2(vs[3] == "10", vs)
ardb.assert2(vs[4] == "100",vs)
vs = ardb.call("sort", "sortset", "by", "weight_*", "get", "sorthash->field_*", "get", "#")
ardb.assert2(table.getn(vs) == 8, vs)
ardb.assert2(vs[1] == "hash1000", vs)
ardb.assert2(vs[2] == "1000",vs)
ardb.assert2(vs[3] == "hash9", vs)
ardb.assert2(vs[4] == "9",vs)
ardb.assert2(vs[5] == "hash10", vs)
ardb.assert2(vs[6] == "10",vs)
ardb.assert2(vs[7] == "hash100", vs)
ardb.assert2(vs[8] == "100",vs)
vs = ardb.call("sort", "sortlist", "by", "weight_*", "get", "sorthash->field_*", "get", "#")
ardb.assert2(table.getn(vs) == 8, vs)
ardb.assert2(vs[1] == "hash1000", vs)
ardb.assert2(vs[2] == "1000",vs)
ardb.assert2(vs[3] == "hash9", vs)
ardb.assert2(vs[4] == "9",vs)
ardb.assert2(vs[5] == "hash10", vs)
ardb.assert2(vs[6] == "10",vs)
ardb.assert2(vs[7] == "hash100", vs)
ardb.assert2(vs[8] == "100",vs)
